﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;

namespace DotConsulting.VisualStudio.BuildOutputCopy.Model
{

    public class OutputFileInfo : INotifyPropertyChanged
    {
        public ProjectBuildInfo Parent { get; private set; }
        public FileInfo FileInfo { get; private set; }

        private bool _selected;
        public bool Selected
        {
            get
            {
                return _selected;
            }
            set
            {
                if (value != _selected)
                {
                    _selected = value;
                    OnPropertyChanged("Selected");
                }
            }
        }

        public OutputFileInfo(FileInfo fi, ProjectBuildInfo parent)
        {
            this.FileInfo = fi;
            this.Parent = parent;
        }

        public string Filename
        {
            get
            {
                return FileInfo.Name;
            }
        }

        public DateTime BuildTS
        {
            get
            {
                return FileInfo.LastWriteTime;
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;

        private void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}
